
<%@ page import="restfuljobs.JobApplication" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'jobApplication.label', default: 'JobApplication')}" />
		<title><g:message code="default.show.label" args="[entityName]" /></title>
	</head>
	<body>
		<a href="#show-jobApplication" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
				<li><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
				<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
			</ul>
		</div>
		<div id="show-jobApplication" class="content scaffold-show" role="main">
			<h1><g:message code="default.show.label" args="[entityName]" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<ol class="property-list jobApplication">
			
				<g:if test="${jobApplicationInstance?.applicant}">
				<li class="fieldcontain">
					<span id="applicant-label" class="property-label"><g:message code="jobApplication.applicant.label" default="Applicant" /></span>
					
						<span class="property-value" aria-labelledby="applicant-label"><g:link controller="user" action="show" id="${jobApplicationInstance?.applicant?.id}">${jobApplicationInstance?.applicant?.encodeAsHTML()}</g:link></span>
					
				</li>
				</g:if>
			
				<g:if test="${jobApplicationInstance?.comments}">
				<li class="fieldcontain">
					<span id="comments-label" class="property-label"><g:message code="jobApplication.comments.label" default="Comments" /></span>
					
						<span class="property-value" aria-labelledby="comments-label"><g:fieldValue bean="${jobApplicationInstance}" field="comments"/></span>
					
				</li>
				</g:if>
			
				<g:if test="${jobApplicationInstance?.education}">
				<li class="fieldcontain">
					<span id="education-label" class="property-label"><g:message code="jobApplication.education.label" default="Education" /></span>
					
						<span class="property-value" aria-labelledby="education-label"><g:fieldValue bean="${jobApplicationInstance}" field="education"/></span>
					
				</li>
				</g:if>
			
				<g:if test="${jobApplicationInstance?.experience}">
				<li class="fieldcontain">
					<span id="experience-label" class="property-label"><g:message code="jobApplication.experience.label" default="Experience" /></span>
					
						<span class="property-value" aria-labelledby="experience-label"><g:fieldValue bean="${jobApplicationInstance}" field="experience"/></span>
					
				</li>
				</g:if>
			
				<g:if test="${jobApplicationInstance?.jobListing}">
				<li class="fieldcontain">
					<span id="jobListing-label" class="property-label"><g:message code="jobApplication.jobListing.label" default="Job Listing" /></span>
					
						<span class="property-value" aria-labelledby="jobListing-label"><g:link controller="jobListing" action="show" id="${jobApplicationInstance?.jobListing?.id}">${jobApplicationInstance?.jobListing?.encodeAsHTML()}</g:link></span>
					
				</li>
				</g:if>

				<g:if test="${jobApplicationInstance?.reviews && session.user.type == restfuljobs.User.Type.RECRUITER}">
				<li class="fieldcontain">
					<span id="reviews-label" class="property-label"><g:message code="jobApplication.reviews.label" default="Reviews" /></span>
					
						<g:each in="${jobApplicationInstance.reviews}" var="r">
						<span class="property-value" aria-labelledby="reviews-label"><g:link controller="jobApplicationReview" action="show" id="${r.id}">${r?.encodeAsHTML()}</g:link></span>
						</g:each>
					
				</li>
				</g:if>
			
				<g:if test="${jobApplicationInstance?.status}">
				<li class="fieldcontain">
					<span id="status-label" class="property-label"><g:message code="jobApplication.status.label" default="Status" /></span>
					
						<span class="property-value" aria-labelledby="status-label"><g:fieldValue bean="${jobApplicationInstance}" field="status"/></span>
					
				</li>
				</g:if>
			
			</ol>
			
				<fieldset class="buttons">					
				<g:if test="${session.user && session.user.type == restfuljobs.User.Type.RECRUITER}">
					<g:if test="${jobApplicationInstance?.reviews == null || jobApplicationInstance?.reviews.size() < 2}">	
					<g:link class="save" controller="jobApplicationReview" action="create" id="${jobApplicationInstance?.id}"><g:message code="default.button.assign.label" default="Assign" /></g:link>
					</g:if>
					<g:else>
					<div style="float: left; width: 200px;">
					<g:form>
						<g:actionSubmit class="save" action="accept" value="${message(code: 'default.button.assign.label', default: 'Accept')}" />
						<g:hiddenField name="id" value="${jobApplicationInstance?.id}" />
						<g:hiddenField name="status" value="${JobApplication.Status.APPLICATION_ACCEPTED}" />
					</g:form>
					</div>
					<div style="float: left; width: 200px;">
					<g:form>
						<g:actionSubmit class="delete" action="reject" value="${message(code: 'default.button.reject.label', default: 'Reject')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
						<g:hiddenField name="id" value="${jobApplicationInstance?.id}" />
						<g:hiddenField name="status" value="${JobApplication.Status.APPLICATION_REJECTED}" />
					</g:form>
					</div>
					</g:else>
				</g:if>
				<g:if test="${session.user && session.user.type == restfuljobs.User.Type.APPLICANT && jobApplicationInstance.status == JobApplication.Status.APPLICATION_RECEIVED}">
					<g:form>	
						<g:link class="edit" action="edit" id="${jobApplicationInstance?.id}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
						<g:actionSubmit class="delete" action="withdraw" value="${message(code: 'default.button.withdraw.label', default: 'Withdraw')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
						<g:hiddenField name="id" value="${jobApplicationInstance?.id}" /> 
						<g:hiddenField name="status" value="${JobApplication.Status.APPLICATION_WITHDRAWN}" />
					</g:form>
				</g:if>
				</fieldset>
			
		</div>
	</body>
</html>
